﻿using AbpEntityFrameworkcore.DbContext;
using AbpToDomain.EntityInfo;
using AbpToDomain.View;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AbpApplication.Expand
{
    public class QueryDynamic_View_Materials
    {

        private readonly MyDbContext context;

        public QueryDynamic_View_Materials(MyDbContext context)
        {
            this.context = context;
        }

        public List<View_Materials> QueryDynameic(string? BoxCode)
        {

            IQueryable<View_Materials> view_Materials = context.viewMaterials;

            if (!string.IsNullOrEmpty(BoxCode))
            {
                view_Materials = view_Materials.Where(b => b.BoxCode.Contains(BoxCode));
            }

            return view_Materials.ToList();
        }
    }
}
